<template>
  <footer class="global-footer">
    <div class="container">
      <div class="footer-content">
        <div class="footer-links">
          <a v-for="link in links" :key="link.key" :href="link.href" target="_blank" rel="noopener noreferrer">
            <span v-if="link.icon" :class="['footer-icon', link.icon]"></span>
            <span>{{ link.title }}</span>
          </a>
        </div>
        <div class="footer-copyright">
          <span>{{ copyright }}</span>
        </div>
      </div>
    </div>
  </footer>
</template>

<script>
export default {
  name: 'GlobalFooter',
  data() {
    return {
      links: [
        {
          key: 'icp',
          title: '闽ICP备2025099953号-2',
          href: 'https://beian.miit.gov.cn/',
          blankTarget: true,
          icon: 'icon-icp'
        },
        {
          key: 'public-security',
          title: '闽公网安备35063102000110号',
          href: 'https://beian.mps.gov.cn/',
          blankTarget: true,
          icon: 'icon-public-security'
        }
      ],
      copyright: `© ${new Date().getFullYear()} 公司名称 版权所有`
    };
  },
  computed: {
    footerStyle() {
      return {
        backgroundColor: '#1f1f1f',
        color: '#999'
      };
    }
  }
};
</script>

<style scoped>
/* 关键：固定定位在底部，宽度100%，z-index确保在内容之上（可按需调整） */
.global-footer {
  position: fixed; 
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 8px 0; /* 减少内边距，让栏更薄，可按需微调 */
  box-sizing: border-box;
  background-color: #fafafa;
  color: #999;
  z-index: 999; /* 防止被其他内容覆盖，数值按需调整 */
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  justify-content: space-between; /* 让链接和版权信息分别在两侧，可根据需求调整布局 */
  align-items: center;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px; /* 调整链接间距 */
}

.footer-links a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: color 0.3s;
  font-size: 12px; /* 减小文字大小让栏更紧凑，按需调整 */
}

.footer-links a:hover {
  color: #fff;
}

.footer-icon {
  display: inline-block;
  width: 16px; /* 缩小图标，让整体更薄 */
  height: 16px;
  margin-right: 4px;
  background-size: contain;
  background-repeat: no-repeat;
}

.footer-copyright {
  font-size: 12px; /* 缩小版权文字大小 */
}

/* 针对移动端适配，可按需调整 */
@media (max-width: 768px) {
  .footer-links {
    flex-direction: column;
    gap: 4px;
  }
  .global-footer {
    padding: 6px 0;
  }
}
</style>